const express = require('express');
const router = express.Router();
const { login, register, getAllUsers, deleteUser, updateUser, uploadXlsxUsers, updatePassword } = require('../controllers/user');
const { upload, uploadFileLocal } = require('../controllers/document')
const { getAllDishes, addDateDish, getDateRangeDish, addDish, deleteDish, updateDish, orderDate, cancelDate, getDateDishUser, getOneDayAllDishDates, getUserAllDateDishs, exportUserDish, countUserDish, searchDetailUserDateDish } = require('../controllers/dish')
const { getNoticeList, getNewestNotice, createNotice, updateNotice, removeNotice, updatePrice, getPrice } = require('../controllers/rule')
const { sendAdvice, getAdvice, deleteAdvice } = require('../controllers/advice')
// const { uploadFile } = require('../controllers/oss');

router.post('/login', login)
router.post('/register', register)

// 上传菜品信息
// router.post('/uploadDish', uploadDish)
// 预定下一天菜品（普通员工）
// router.post('/orderDish', orderDish)
// 获取菜品信息
// router.get('/getDish', getDish)
// 获取当天菜品                                   信息
// router.get('/getTodayDish', getTodayDish)
// 获取日期区间的菜品信息
router.post('/getDateRangeDish', getDateRangeDish)
router.post('/getDishes', getAllDishes)
// 添加菜品信息
router.post('/addDateDish', addDateDish)


router.post('/addDish', addDish)
router.post('/deleteDish', deleteDish)
router.post('/updateDish', updateDish)
router.post('/orderDate', orderDate)
router.post('/cancelDate', cancelDate)
router.post('/getDateDishUser', getDateDishUser)
router.post('/updatePassword', updatePassword)

router.post('/getAllUsers', getAllUsers)
router.post('/deleteUser', deleteUser)
router.post('/register', register)
router.post('/updateUser', updateUser)
router.post('/uploadXlsxUsers', upload.single('file'), uploadXlsxUsers);
router.post('/countUserDish', countUserDish)
router.post('/exportUserDish', exportUserDish)
router.post('/getOneDayAllDishDates', getOneDayAllDishDates)
router.post('/getUserAllDateDishs', getUserAllDateDishs)
router.post('/searchDetailUserDateDish', searchDetailUserDateDish)

router.post('/getNoticeList', getNoticeList)
router.post('/getNewestNotice', getNewestNotice)
router.post('/createNotice', createNotice)
router.post('/updateNotice', updateNotice)
router.post('/removeNotice', removeNotice)

router.post('/updatePrice', updatePrice)
router.post('/getPrice', getPrice)

router.post('/sendAdvice', sendAdvice)
router.post('/getAdvice', getAdvice)
router.post('/deleteAdvice', deleteAdvice)
// 多个文件上传
router.post('/uploadFiles', upload.array('file', 9), uploadFileLocal)
module.exports = router;
